# -----App Manual-----#
#! python3
# coding:utf-8
# description: #从指定群组添加好友
# author: terry
# -------------------#

import itchat


#添加好友话术
greattings="我是TerryD，在练习itchat，请多指教"

def grap_group_members(name_wanted):
    myroom=itchat.search_chatrooms(name=name_wanted) 
    if myroom is None:
        return ('%s Group is not found' %(name_wanted))
    else:
        room_obj=itchat.update_chatroom(userName=myroom[0]['UserName'],detailedMember=True)
        nickname=[]
        for m in room_obj['MemberList']:
            #print (m['NickName'],m['Sex'],m['RemarkName'])
            nickname.append({'NickName':m['NickName'],'userName':m['UserName']})
    return  nickname

def add(user):
    pass

#itchat.add_friend(userName='大包',status=2,)

""" #给文件助手发消息
itchat.send(msg='Hell,fileHelper',toUserName='filehelper')

# 给文件助手发文件
itchat.send_file('temp.txt',toUserName='filehelper') """

# 程序框架
itchat.auto_login(hotReload=True)
# m=grap_group_members('未来鲜森 安装报修运维群')
# for p in m:
#     print (p)

res=itchat.add_friend(userName='e9910f947bd307c0b849f7eb4e75a09b0dc4a0af10c3c795e336722d92515d76',status=2,autoUpdate=True,verifyContent='hello from terry')
print(type(res),'\n', res)
